<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div style="width:100px;height:100px;background-color:red">
			
		</div>
		<script type="text/javascript">
			var div = document.getElementsByTagName('div')[0];
			/*div.onclick = function(){
				console.log(this);//div本身
			};
			
			div.addEventListener('click',function(){
				console.log(this);//div本身
			});*/
			
		/*	div.attachEvent('onclick',function(){
				handle.call(div);
//				console.log(this);
			});
			
			function handle(){
				console.log(this);
			}*/
			
			/*public addEvent(elem,type,handle){
				if(elem.addEventListener()){
					elem.addEventListener(elem,handle,false);
				}eles if(elem.attachEvent()){
					elem.attachEvent('on' + type,function(){
						handle.call(elem);
					});
				}else{
					elem.onClick = handle;
				}
			}*/
			
			//事件解除
			/*div.onclick = function(){
				console.log('a');
				this.onclick = null;
			}
			div.onclick = null;*/
			
			/*div.addEventListener('click',test,false);
			div.removeEventListener('click',test,false);
			function test(){
				console.log('a');
			}*/

			
			
			
			
		</script>
	</body>
</html>
